//
// Created by 12345 on 2025/2/19.
//

#ifndef DEVICE_AGENT_DOG58_PROJECT_COMMAND_BEAN_H
#define DEVICE_AGENT_DOG58_PROJECT_COMMAND_BEAN_H

#include "string"
#include "daf/DeviceAgentModel.pb.h"
#include "daf/daf_model.h"
#include "report_bean.h"
#include "gazella/interface_timer.h"
#include "utils.h"
#include "gazella/logger.h"
#include <cmath>

class CommandBean {
public:


    static CommandBean* getInstance();
    std::string build();
    void reset();

    void forceCode(const DeviceAgentModel::DeviceAgentProperty& cmd, DeviceAgentModel::DeviceAgentProperty& ack);//解锁力控
    void standSitCode(const DeviceAgentModel::DeviceAgentProperty& cmd, DeviceAgentModel::DeviceAgentProperty& ack);//起立/趴下
    void scramCode(const DeviceAgentModel::DeviceAgentProperty& cmd, DeviceAgentModel::DeviceAgentProperty& ack);//急停
    void tabu(const DeviceAgentModel::DeviceAgentProperty& cmd, DeviceAgentModel::DeviceAgentProperty& ack);//设置踏步状态
    void markTime(const DeviceAgentModel::DeviceAgentProperty& cmd, DeviceAgentModel::DeviceAgentProperty& ack);//设置踏步模式
    void reinforcementLearningCode(const DeviceAgentModel::DeviceAgentProperty& cmd, DeviceAgentModel::DeviceAgentProperty& ack);//进入RL模式
    void modeStopCode(const DeviceAgentModel::DeviceAgentProperty& cmd, DeviceAgentModel::DeviceAgentProperty& ack);//模式取消
    void ctlJoy(const DeviceAgentModel::DeviceAgentProperty& cmd, DeviceAgentModel::DeviceAgentProperty& ack);//遥杆控制
    void chargeControl(const DeviceAgentModel::DeviceAgentProperty& cmd, DeviceAgentModel::DeviceAgentProperty& ack);//充电控制
    void videoStream(const DeviceAgentModel::DeviceAgentProperty& cmd, DeviceAgentModel::DeviceAgentProperty& ack);//视频切换：镜头选择+视频模式
    void targetIdentity(const DeviceAgentModel::DeviceAgentProperty& cmd, DeviceAgentModel::DeviceAgentProperty& ack);//目标识别开关
    void targetTrackin(const DeviceAgentModel::DeviceAgentProperty& cmd, DeviceAgentModel::DeviceAgentProperty& ack);//目标跟踪开关
    void targetSelection(const DeviceAgentModel::DeviceAgentProperty& cmd, DeviceAgentModel::DeviceAgentProperty& ack);//目标选择
    void assurance(const DeviceAgentModel::DeviceAgentProperty& cmd, DeviceAgentModel::DeviceAgentProperty& ack);//保险
    void attack(const DeviceAgentModel::DeviceAgentProperty& cmd, DeviceAgentModel::DeviceAgentProperty& ack);//打击
    void attackChoice(const DeviceAgentModel::DeviceAgentProperty& cmd, DeviceAgentModel::DeviceAgentProperty& ack);//打击目标选择
    void objidentify(const DeviceAgentModel::DeviceAgentProperty& cmd, DeviceAgentModel::DeviceAgentProperty& ack);//打击目标确认
    void calculate(const DeviceAgentModel::DeviceAgentProperty& cmd, DeviceAgentModel::DeviceAgentProperty& ack);//火控解算




private:
    bool standSitFlag= false;     //false：无效 true 起立/趴下
    bool unlockFlag = false;            //false：无效 true：解锁力控
    bool scramFlag = false;            //false：无效 true：急停
    uint8_t modeCode = 0;             //0：无效 1：踏步 2：RL模式 3：停止踏步/退出RL模式
    uint8_t forwardBackDir = 0;     //前进后退 方向 0：前，1：后
    uint8_t forwardBackSpeed = 0;    // 前进/后退 速度 0-100:速度值
    uint8_t leftRightDir=0;  //左右平移 方向 0：左，1：右
    uint8_t leftRightSpeed=0;//左右平移速度 0-100:速度值
    uint8_t leftRightTurnDir=0;  //左转右转 方向 0：左，1：右
    uint8_t leftRightTurnSpeed=0;//左转右转速度 0-100:速度值
    uint8_t gaitCode = 0;             //0：轻步态 1：楼梯 2：斜坡 3：匍匐 4：跑步 5：感知楼梯 9：跨沟 8：RL无感知行走
    uint8_t fuYangDir=0;  //俯仰 方向 0：俯，1：仰
    uint8_t fuYangSpeed=0;//俯仰速度 0-100:速度值
    uint8_t chargeCode = 0;           //0：无效 1：开始充电 2：结束充电
    uint8_t video1OptionCode = 0;    //0：无视频流 1：白光 2：红外
    uint8_t targeShibieCode = 0;     //0：关闭目标识别 1：开启目标识别
    uint8_t targeGenzongCode = 0;    //0：关闭目标跟踪 1：开启目标跟踪
    uint8_t tiaojiao_code = 0;         //0：无效 1：调焦+ 2：调焦—
    uint8_t bianbei_code = 0;          //0：无效 1：变倍+ 2：变倍—
    uint8_t baoxian = 0;//00无效 01开保险 02开单点 03开连续
    uint8_t daji = 0; //0关闭1打击
    uint8_t mubiaoxuanze = 0;//00无效 01 左移 02 右移（触发式，其余时间发0）
    uint8_t mubiaoqueren = 0;//00无效 01 确认 02 取消确认
    uint8_t huokongjiesuan = 0; //00无效 01 开启
    uint8_t zaiheType = 0;
    uint8_t zaiheCmd = 0;
    uint8_t zaiheData = 0;
    std::string sendPayload;
    CommandBean()=default;
    ~CommandBean()=default;

};


#endif //DEVICE_AGENT_DOG58_PROJECT_COMMAND_BEAN_H
